<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="{{ url_for('static',filename='layui/css/layui.css') }}">
    <script type="text/javascript" src="{{ url_for('static',filename='jquery/jquery-3.5.1.min.js') }}"></script>
    <script type="text/javascript">
        $(function () {
            $.ajax({
                url: "getUserInfo",
                method: "get",
                success: function (result) {
                    {#将json字符串转化为json对象#}
                    jsonObj=JSON.parse(result);
                    var str="";
                    $.each(jsonObj,function (index,row){
                        var static1="";
                        if(row[3]==0)
                            static1="<button class='layui-btn layui-btn-warm'>启用</button>"
                        else
                            static1="<button class='layui-btn layui-btn-success'>禁用</button>"
                       str+="<tr><td><input type='checkbox'></td><td>"+(index+1)+"</td><td>"+row[1]+"</td><td>"+row[2]+"</td><td>"+static1+
                           "</td><td><a href='#' class='layui-btn'><span class='layui-icon layui-icon-delete'></span> 删除</a></td></tr>"
                    });
                    $("#tbody").html(str);
              {#      layer.msg(result, {
                        time: 3000,
                        icon: 1
                    });#}
                },
                error: function (e) {
                    console.log(e)
                    layer.msg("请求服务器失败", {
                        time: 3000,
                        icon: 2
                    });
                }
            });
        });
    </script>
</head>
<body>
<div class="layui-elem-quote">
    用户列表
</div>
<table class="layui-table">
    <tr>
        <td><input type="checkbox">全选</td>
        <th>id</th>
        <th>用户名</th>
        <th>密码</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    <tbody id="tbody">

    </tbody>
</table>


<script src="{{ url_for('static',filename='layui/layui.js') }}"></script>
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        var element = layui.element;

    });
</script>
</body>
</html>